#ifndef _POLLER_H_
#define _POLLER_H_

#include "socket.h"
#include <array>
namespace as
{
namespace snet
{

class PollerInstance
{
public:
	virtual ~PollerInstance() = default;
	virtual void on_poll(void *key, void *ev) = 0;
};

class Poller
{
public:
	enum
	{
		POLL_EVENT_COUNT = 128,
	};

	Poller(PollerInstance &poll_inc);

	bool add(socket_fd fd, void *key);
	void poll();
private:
	PollerInstance &m_pollInc;
#ifdef _WIN32
	HANDLE m_ioPort;
	std::array<OVERLAPPED_ENTRY, POLL_EVENT_COUNT> m_events;
#else
	int m_ioPort;
#endif
};
}
}
#endif